<?php
/**
 * Created by PhpStorm.
 * User: 颖inv
 * Date: 2016/10/12
 * Time: 20:50
 */
header('content-type:text/html;charset=utf-8');
if(!defined('APP')) die('error'); ?>
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>员工信息列表</title>
    <style>
        table{border-collapse: collapse; border: #eeeeee; margin: 0 auto;}
        tr{text-align: center; height: 30px;}
        th{height: 35px; text-align: center;}
        h2{text-align: center;}
        form{margin-left: 660px; margin-bottom: 15px;}
        .part{margin-left: 770px; margin-top: 20px;}
        .add{margin-left: 880px; margin-top: 20px;}
    </style>
</head>
<body>
    <h2>员工信息列表</h2>
    <form action="./showList.php" method="GET">
        <div>快速查询：<input type="text" name="keyword" />
                        <input type="submit" value="提交" /></div>
    </form>
    <table border="1">
        <tr>
            <th width="5%">ID</th>
            <th>姓名</th>
            <th><a href="./showList.php?order=e_dept&sort=<?php echo ($order=='e_dept')? $sort:'desc';?>"> 所属部门</a></th>
            <th>出生日期</th>
            <th><a href="./showList.php?order=date_of_entry&sort=<?php echo ($order=='date_of_entry') ? $sort:'desc';?>"> 入职时间</a></th>
            <th width="25%">相关操作</th>
        </tr>


        <?php if(!empty($emp_info)){ ?>
            <?php foreach($emp_info as $row){ ?>
                <tr>
                    <td><?php echo $row['e_id']; ?></td>
                    <td><?php echo $row['e_name']; ?></td>
                    <td><?php echo $row['e_dept']; ?></td>
                    <td><?php echo $row['date_of_birth']; ?></td>
                    <td><?php echo $row['date_of_entry']; ?></td>
                    <td><div><span><a href="<?php echo './empUpdate.php?e_id='.$row['e_id']?>">编辑</a>&nbsp;  &nbsp;
                               <a href="./empDel.php?e_id=<?php echo $row[`e_id`];?>">删除</a></span></div></td>
                </tr>
            <?php } ?>
        <?php }else{ ?>
            <tr><td colspan="6">查询的结果不存在！</td></tr>
        <?php } ?>
    </table>
<!--输出分页链接-->
    <div class="part"><a href="./showList.php"><?php echo $page_html;?></a></div>
<!--添加员工链接-->
    <div class="add"><a href="./empAdd.php">添加员工</a> </div>
</body>
</html>